import { reviewTypeMap } from '@/config/dict'
import { byKeyGetItem, parseTime } from '@/utils'

export const searchFormItem = [
  {
    type: 'select',
    key: 'reviewType',
    label: '类型',
    options: reviewTypeMap
  }
]

export const reviewTableColumn = (handleDelete) => {
  return [
    {
      key: 'nickName',
      label: '姓名',
      minWidth: 120
    },
    {
      key: 'reviewContent',
      label: '评论内容',
      minWidth: 200
    },
    {
      key: 'reviewType',
      label: '类型',
      minWidth: 100,
      render: (h, scope) => byKeyGetItem(reviewTypeMap, scope.row.reviewType).value
    },
    {
      key: 'createTime',
      label: '时间',
      minWidth: 200,
      render: (h, scope) => parseTime(scope.row.createTime)
    },
    {
      type: 'button',
      label: '操作',
      list: [
        {
          name: '删除',
          confirm: '确定删除吗?',
          click: handleDelete
        }
      ]
    }
  ]
}

export const rewardTableColumn = (handleDelete) => {
  return [
    {
      key: 'money',
      label: '打赏金额',
      minWidth: 100
    },
    {
      key: 'nickName',
      label: '打赏人姓名',
      minWidth: 100
    },
    {
      key: 'orderNo',
      label: '订单号',
      minWidth: 160
    },
    {
      key: 'paySerialNo',
      label: '支付流水号',
      minWidth: 160
    },
    {
      key: 'createTime',
      label: '时间',
      minWidth: 200,
      render: (h, scope) => parseTime(scope.row.createTime)
    }
    // {
    //   type: 'button',
    //   label: '操作',
    //   list: [
    //     {
    //       name: '删除',
    //       confirm: '确定删除吗?',
    //       click: handleDelete
    //     }
    //   ]
    // }
  ]
}
